package com.juc.completableFuture;

import java.util.concurrent.CompletableFuture;

public class CompletableFutureDemo5 {

	public static void main(String[] args) {
		System.out.println(CompletableFuture.supplyAsync(()->{
			return 10;
		}).thenCombine(CompletableFuture.supplyAsync(()->{
			return 20;
		}), (r1,r2)->{
			return r1 +r2;
		}).thenCombine(CompletableFuture.supplyAsync(()->{
			return 30;
		}), (r3,r4)->{
			return r3 +r4;
		}).join());
	}
}
